<script>
	import Vue from 'vue'
	export default {
		onLaunch: function() {
			console.log('App Launch')
			// 尝试提取本地存储用户信息
			try{
				const value = uni.getStorageSync('userInfo');
				if (value) {
					this.$store.commit('user/initInfoMut',value)
					this.$store.dispatch('address/addressInitAct',value.objectId) //初始化地址列表
				}
			}catch(e){
				//TODO handle the exception
				console.log('本地存储提取失败');
			}
			
			// 获取系统信息,做导航栏兼容
			uni.getSystemInfo({
				success: function(e) {
					// #ifndef MP
					Vue.prototype.StatusBar = e.statusBarHeight;
					if (e.platform == 'android') {
						Vue.prototype.CustomBar = e.statusBarHeight + 50;
					} else {
						Vue.prototype.CustomBar = e.statusBarHeight + 45;
					};
					// #endif
			
					// #ifdef MP-WEIXIN
					Vue.prototype.StatusBar = e.statusBarHeight;
					let custom = wx.getMenuButtonBoundingClientRect();
					Vue.prototype.Custom = custom;
					Vue.prototype.CustomBar = custom.bottom + custom.top - e.statusBarHeight;
					// #endif		
			
					// #ifdef MP-ALIPAY
					Vue.prototype.StatusBar = e.statusBarHeight;
					Vue.prototype.CustomBar = e.statusBarHeight + e.titleBarHeight;
					// #endif
				}
			})
			
		},
		onShow: function() {
			console.log('App Show')
		},
		onHide: function() {
			console.log('App Hide')
		}
	}
</script>

<style lang="scss">
	/*每个页面公共css */
	@import "uview-ui/index.scss";
	@import '/static/css/base.css';
	@import '/static/font/iconfont.css';
	@import '/colorui/main.css';
	@import '/colorui/icon.css';
</style>
